import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import '../base/base_app.dart';

/// 创建人： Created by zhaolong
/// 创建时间：Created by  on 2021/9/25.
///
/// gongzhonghao biglead
/// https://study.163.com/instructor/1021410098.htm
/// https://blog.csdn.net/zl18603543572
/// https://www.toutiao.com/c/user/token/MS4wLjABAAAAYMrKikomuQJ4d-cPaeBqtAK2cQY697Pv9xIyyDhtwIM/
///
///
///

//应用入口
void main() {
  ///启动根目录
  runApp(BaseApp(
    homeWidget: Example410(),
  ));
}

///代码清单 4-17
///lib/code/code4/example_410_imageshow_page.dart
///图片浏览器
class Example410 extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _ExampleState();
  }
}

class _ExampleState extends State<Example410> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("图片浏览器"),
      ),
      backgroundColor: Colors.white,
      body: Center(child: buildSegment(),),
    );
  }

  //Card 是 flutter 提供的一个卡片组件，提供了圆角和阴影
  ///代码清单 4-10
  ///lib/code4/example_413_card_page.dart
  buildSegment() {
    return Card(
      color: Colors.blue, // 背景色
      shadowColor: Colors.black, // 阴影颜色
      elevation: 20, // 阴影高度
      borderOnForeground: true, // 是否在 child 前绘制 border，默认为 true
      margin: EdgeInsets.fromLTRB(0, 50, 0, 30), // 外边距
      child: Container(
        width: 200,
        height: 100,
        alignment: Alignment.center,
        child: Text("卡片效果", style: TextStyle(color: Colors.white),),
      ),
    );
  }

  Card _shapeCard(){
    return Card(
      color: Colors.red, // 背景色
      shadowColor: Colors.yellow, // 阴影颜色
      elevation: 20, // 阴影高度
      borderOnForeground: false, // 是否在 child 前绘制 border，默认为 true
      margin: EdgeInsets.fromLTRB(0, 50, 0, 30), // 外边距

      // 边框
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(40),
        side: BorderSide(
          color: Colors.yellow,
          width: 3,
        ),
      ),

      child: Container(
        width: 100,
        height: 100,
        alignment: Alignment.center,
        child: Text("Shape Card", style: TextStyle(color: Colors.white),),
      ),
    );
  }
}
